# 字典
alien_0 = {'color': 'blue', 'points': 5};
alien_0['color'] = 'green';
alien_0['x'] = 100;

print(alien_0)
del alien_0['x']
print(alien_0)
print(alien_0.get('x', 200)) # 没有的默认值

# 遍历
favorite_languages = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'rust',
    'phil': 'python',
    # 'fruits': ['apple', 'strawberry', 'banana']
    }
for name, language in favorite_languages.items():
    print(f"{name.title()}'s favorite language is {language.title()}")

print(favorite_languages.keys())

for value in set(favorite_languages.values()):
    print(value.title())

# 不同的字典
users = {
    'aeinstein': {
        'first': 'albert',
        'last': 'einstein',
        'location': 'princeton',
    },

    'mcurie': {
        'first': 'marie',
        'last': 'curie',
        'location': 'paris',
    },

}

for username, user_info in users.items():
    print(f"\nUsername: {username}")
    full_name = f"{user_info.get('first')} {user_info.get('last')}"
    loction = user_info.get('location')
    print(f"\tfull name: {full_name.title()}")
    print(f"\tlocation: {loction.title()}")